/**
 * 
 */
package org.gigi.core.web;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.context.request.WebRequest;

/**
 * 用于Gigi的，自定义的处理RequestParameter的PropertyEditors
 *
 * <p>也可以在controller类中采用{@link org.springframework.web.bind.annotation.InitBinder}注解方式。
 *
 * @author Eugene Wang 2011-5-29
 * @see
 */
public class GigiBindingInitializer implements WebBindingInitializer {
	/**
	 * 初始化绑定Editors
	 */
	public void initBinder(WebDataBinder binder, WebRequest request) {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
		dateFormat.setLenient(false);
		binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
	}
}
